const utf8 = require('utf8');

export const createWsServer = (machineConfig: any, socket: any) => {
  //
  socket.send(JSON.stringify({id:'',msg:'连接成功'}));

  // 监听前端消息
  socket.on('message', function (data: any) {
    const objData= JSON.parse(data);
    
    const sendMsg = { id: objData.id, msg: `接收方：${objData.id},msg:随便构造数据u` };
    socket.send(JSON.stringify(sendMsg));
  });
};
